 package org.mybatis.core.interfaces.impl;
 
 import java.util.Locale;

import org.mybatis.core.interfaces.NameGenerator;
 
 public class DefaultNameGenerator
   implements NameGenerator
 {
   public String getGeneratorNameByName(String fieldName)
   {
     StringBuffer buffer = new StringBuffer(fieldName);
     for (int i = 0; i < buffer.length(); i++) {
    	 if(i==0){
    		 continue;
    	 }
       char c = buffer.charAt(i);
       if (Character.isUpperCase(c)) {
         buffer.insert(i++, '_');
       }
     }
     return buffer.toString().toUpperCase(Locale.ENGLISH);
   }
 }

